﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.DomainServices.Server;
using NetBay.Core.BusinessEntities;
using Rio.Manager.Business.Repository;
using Rio.Doc.Business.Repository;

namespace Rio.Applications.Web.Services
{
    public partial class BusinessEntitiesDomainService : DomainService
    {
        /// <summary>
        /// Gets all RIO organizations.
        /// </summary>
        /// <returns></returns>
        [Query(HasSideEffects = true)]
        public IEnumerable<Organization> GetAllRioOrganization()
        {
            //Variable Initialization.
            var l_oReturnRioOrganization = new List<Organization>();

            //Log.
            NetBay.Core.Log.LogManager.Instance().LogDebug("OrganizationDS.GetAllRioOrganization (No parameters)...");

            try
            {
                l_oReturnRioOrganization = OrganizationRepository.GetAllRioOrganization();
            }
            catch (Exception ex)
            {
                //Error.
                NetBay.Core.Log.LogManager.Instance().LogError("OrganizationDS.GetAllRioOrganization Exception [" + ex.Message + "]");
                l_oReturnRioOrganization = null;
            }
            return l_oReturnRioOrganization;
        }
    }
}